<html>
<header>
  <meta charset="utf-8" />
  <link href="<%=staticRelativePath%>/normalize.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" href="<%=staticRelativePath%>/iconfont/iconfont.css">
  <style type="text/css">
    table {
      width: 100%;
    }

    table,
    th,
    td {
      border: 1px solid black;
      text-align: center;
    }

    table>thead {
      background-color: #88898B;
      color: white;
    }

    .testcase-tr {
      background-color: #C8C9CA;
    }

    .hide-td-border {
      border: none;
    }

    .colspan-text-align {
      text-align: start;
    }

    .function-count {
      text-align: end;
    }

    .function-test-count {
      text-align: end;
    }

    .test-result-succeed {
      color: #4DD5B3;
    }

    .test-result-nonStrictSucceed {
      color: #BF901D;

    }

    .test-result-failed {
      color: #CC3E35;
    }

    .test-result-exception {
      color: #FFBB36;
    }

    .test-result-codeDefect {
      color: #DE640F;
    }

    .test-result-noResult {
      color: #7B7B7B;
    }
    
    .test-result-unknown {
      color: #5188F4;
    }
    .back-to-top {
      margin: 20px;
      text-align: center;
    }
    a {
        text-decoration: none;
     }
    a:visited {
       color: #00e; 
       text-decoration: none; /* 去掉下划线等文本修饰 */
    }
  </style>
</header>

<body style="padding-top: 20px;">

<div id = "top" style="text-align: center">
  <h1>集成测试报告总览</h1>
</div>
<div style="text-align: right;"><span>日期：<%=reportTime%>&nbsp;&nbsp;</span></div>
<div>
  <table>
    <tbody>
    <tr>
      <td>项目名称</td>
      <td colspan="2">
        <%=overview.projectName%>
      </td>
    </tr>
    <tr>
      <td>版本号</td>
      <td colspan="2">
        <%=overview.versionName%>
      </td>
    </tr>
    <tr>
      <td rowspan="7">测试概况(测试对象统计)</td>
      <td>
        <% if(jumpable){%>
          <a href = "#functionCoverage">源文件（个）</a>
          <%} else {%>
            源文件（个）
        <%}%>
      </td>
      <td>
        <%=overview.sourceFileCount%>
      </td>
    </tr>
    <tr>
      <td>头文件（个）</td>
      <td>
        <%=overview.headerFileCount%>
      </td>
    </tr>
    <tr>
      <td>
        <% if(jumpable){%>
          <a href="#functionCoverage">函数（个）</a>
          <%} else {%>
            函数（个）
        <%}%>
      </td>
      <td>
        <%=overview.functionCount%>
      </td>
    </tr>
    <tr>
      <td>
        <% if(jumpable){%>
          <a href="#functionCoverage">函数通过数（个）</a>
          <%} else {%>
            函数通过数（个）
        <%}%>
      </td>
      <td>
        <%=functionResultsStatistic.passed%>
      </td>
    </tr>
    <tr>
      <td rowspan="3">代码行数</td>
      <td>总行数：<%=overview.numberOfLines%>
      </td>
    </tr>
    <tr>
      <td>源文件行数：<%=overview.sourceNumberOfLines%>
      </td>
    </tr>
    <tr>
      <td>头文件行数：<%=overview.headerNumberOfLines%>
      </td>
    </tr>
    <% for( let index = 0; index < enabledCoverageKind.length; index++ ) { %>
      <tr>
        <% if (index === 0) { %>
          <td rowspan="<%= 2 * enabledCoverageKind.length %>">覆盖概况(<% if (coverageRange === 1) { %>测试对象统计<% } else { %>所选文件函数统计<% } %>)</td>
        <% } %>
        <% if(['语句覆盖','分支覆盖','条件覆盖','决策覆盖','MC/DC覆盖'].includes(enabledCoverageKind[index].name)) {%>
          <td rowspan="2">
            <% if(jumpable){%>
              <a href="#unitCoverage"><%=enabledCoverageKind[index].name%></a>
              <%} else {%>
                <%=enabledCoverageKind[index].name%>
            <%}%>
          </td>
        <%}else{%>
          <td rowspan="2">
            <% if(jumpable){%>
              <a href="#integrateCoverage"><%=enabledCoverageKind[index].name%></a>
              <%} else {%>
                <%=enabledCoverageKind[index].name%>
            <%}%>
          </td>
        <%}%>
        <td><%=overview[enabledCoverageKind[index].coverageKey]%></td>
      </tr>
      <tr>
        <td><%=overview[enabledCoverageKind[index].coveredKey]%>/<%=overview[enabledCoverageKind[index].totalKey]%></td>
      </tr>
    <% } %>
    </tbody>

  </table>
</div>

<h2>测试用例统计</h2>
<p><span>&nbsp;&nbsp;&nbsp;&nbsp; 以下数据是统计测试用例在通过、通过*、未通过、执行异常、运行时错误、无结果以及未执行七种的用例个数。</span></p>
<div style="float: left; width: 40%;">
  <table>
    <tr>
      <th>用例总数</th>
      <th><%=testsOverview.total%></th>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-icon-pass test-result-succeed"></span>&nbsp通过</td>
      <td><%=testsOverview.succeed%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-icon-pass test-result-nonStrictSucceed"></span>&nbsp通过*</td>
      <td><%=testsOverview.nonStrictSucceed%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-icon-nopass test-result-failed"></span>&nbsp未通过</td>
      <td><%=testsOverview.failed%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-icon-warning test-result-exception"></span>&nbsp执行异常</td>
      <td><%=testsOverview.exception%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-code-defect test-result-codeDefect"></span>&nbsp运行时错误</td>
      <td><%=testsOverview.codeDefect%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-icon-no-result test-result-noResult"></span>&nbsp无结果</td>
      <td><%=testsOverview.noResult%></td>
    </tr>
    <tr>
      <td><span class="icon iconfont icon-unanalysis test-result-unknown"></span>&nbsp未执行</td>
      <td><%=testsOverview.unknown%></td>
    </tr>
  </table>
</div>
<div style="float: left; width:40%; margin-left: 100px;">
  <img width="100%" src="<%=testCaseResultsImage%>">
  <p style="text-align: center;"><span>图1: 用例执行结果统计</span></p>
</div>
<div style="clear: both;"></div>
<h2 class="new-page">测试函数统计</h2>
<p><span>&nbsp;&nbsp;&nbsp;&nbsp; 以下数据是统计测试函数在通过、未通过以及未定义三种结果的函数个数。</span></p>
<div style="float: left; width: 40%;">
  <table>
    <tr>
      <th>函数总数</th>
      <th><%=overview.functionCount%></th>
    </tr>
    <tr>
      <td>通过</td>
      <td><%=functionResultsStatistic.passed%></td>
    </tr>
    <td>未通过</td>
    <td><%=functionResultsStatistic.failed%></td>
    </tr>
    <td>未定义</td>
    <td><%=functionResultsStatistic.undefined%></td>
    </tr>
  </table>
</div>
<div style="float: left; width:40%; margin-left: 100px;">
  <img width="100%" src="<%=functionResultsImage%>">
  <p style="text-align: center;"><span>图2: 函数执行结果统计</span></p>
</div>
<div style="clear: both;"></div>

<h2>用例/函数结果说明</h2>
<table>
  <tr>
    <th>用例结果</th>
    <th>函数结果</th>
    <th>说明</th>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-icon-pass test-result-succeed"></span>&nbsp通过</td>
    <td rowspan="2">通过</td>
    <td>用例执行通过，预期值与实际值相等。当前函数所有用例执行通过，则函数执行结果为通过。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-icon-pass test-result-nonStrictSucceed"></span>&nbsp通过*</td>
    <td>用例执行通过，无预期值。
      配置信息中没有勾选“未设定预期值时，不可通过，视为无结果”。
      当前函数所有用例执行为通过/通过*，则函数执行结果为通过。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-icon-nopass test-result-failed"></span>&nbsp未通过</td>
    <td rowspan="3">未通过</td>
    <td>用例执行不通过，预期值与实际值不相等。
      当前函数对应用例执行存在未通过，则函数执行结果为未通过。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-icon-warning test-result-exception"></span>&nbsp执行异常</td>
    <td>用例执行出现异常。
      当前函数对应用例执行存在执行异常，则函数执行结果为未通过。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-code-defect test-result-codeDefect"></span>&nbsp运行时错误</td>
    <td>用例执行出现运行时错误。
      当前函数对应用例执行存在运行时错误，则函数执行结果为未通过。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-icon-no-result test-result-noResult"></span>&nbsp无结果</td>
    <td rowspan="2">未定义</td>
    <td>用例执行通过，无预期值。
      配置信息中勾选了“未设定预期值时，不可通过，视为无结果”。
      当前函数对应用例执行全部为无结果或在通过/通过*中包含无结果，则函数执行结果为未定义。</td>
  </tr>
  <tr>
    <td><span class="icon iconfont icon-unanalysis test-result-unknown"></span>&nbsp未执行</td>
    <td>用例未执行。
      当前函数存在未执行的用例，则函数执行结果为未定义。</td>
  </tr>
</table>
<%if(jumpable){%>
  <div class="back-to-top">[ <a href="#top">返回开始</a> ]</div>
<%}%>
<div id="functionCoverage"></div>
<% if (enabledUTCoverageKind.length > 0) { %>
<h2 id ="unitCoverage">集成结果统计（语句覆盖、分支覆盖、条件覆盖、决策覆盖、MC/DC覆盖）</h2>
<p><span>共有<%=overview.functionCount%>个函数，通过<%=functionResultsStatistic.passed%>个。</span></p>
<table>
  <tr>
    <th>序号</th>
    <th>文件</th>
    <th>函数</th>
    <% for( let i = 0; i < enabledUTCoverageKind.length; i++ ) { %>
      <th><%=enabledUTCoverageKind[i].name%></th>
    <% } %>
    <th>执行结果</th>
  </tr>
  <% for( let i = 0; i < functionsOverview.length; i++ ) {
    const { index, fileName, functionName, resultKind, coverageInfoUT ,filePath, testCount} = functionsOverview[i];
    const newFilePath = `${filePath}.html`;
    const fileFuncPath = `${newFilePath}#${functionName}`; %>
  <tr>
    <td rowspan="2"><%=index%></td>
    <td rowspan="2">
      <%if(jumpable && testCount >0 && !noFiles){%>
        <a href= "<%= newFilePath %>" target="_blank"><%=fileName%></a>
      <%} else{%>
        <%=fileName%>
      <%}%>
    </td>
    <td rowspan="2">
      <%if(jumpable && testCount > 0 && !noFiles){%>
        <a href= "<%= fileFuncPath %>" target="_blank"><%=functionName%></a>
      <%} else{%>
        <%=functionName%>
      <%}%>
    </td>
    <% for( let i = 0; i < enabledUTCoverageKind.length; i++ ) { %>
      <td><%= coverageInfoUT[i].coverage %></td>
    <% } %>
    <td rowspan="2"><%=resultKind%></td>
  </tr>
  <tr>
    <% for( let index = 0; index < enabledUTCoverageKind.length; index++ ) { %>
      <td><%= coverageInfoUT[index].covered%>/<%=coverageInfoUT[index].total %></td>
    <% } %>
  </tr>
  <% } %>
</table>
<%if(jumpable){%>
  <div class="back-to-top">[ <a href="#top">返回开始</a> ｜ <a href="#unitCoverage">返回本节</a> ]</div>
<%}%>
<% } %>

<h2 id ="integrateCoverage">集成结果统计（函数覆盖、调用覆盖）</h2>
<p><span>共有<%=overview.functionCount%>个函数，通过<%=functionResultsStatistic.passed%>个。</span></p>
<table>
  <tr>
    <th>序号</th>
    <th>文件</th>
    <th>函数</th>
    <th>集成函数</th>
    <% for( let i = 0; i < enabledITCoverageKind.length; i++ ) { %>
    <th><%=enabledITCoverageKind[i].name%></th>
    <% } %>
    <th>执行结果</th>
  </tr>
  <% for( let i = 0; i < functionsOverview.length; i++ ) {
    const { index, fileName, functionName, resultKind, coverageInfoIT, integrationFunctions, filePath, testCount } = functionsOverview[i];
    const newFilePath = `${filePath}.html`;
    const fileFuncPath = `${newFilePath}#${functionName}`; %>
  <tr>
    <td rowspan="2"><%=index%></td>
    <td rowspan="2">
      <%if(jumpable && testCount > 0 && !noFiles){%>
        <a href= "<%= newFilePath %>" target="_blank"><%=fileName%></a>
      <%} else{%>
        <%=fileName%>
      <%}%>
    </td>
    <td rowspan="2">
      <%if(jumpable && testCount > 0 && !noFiles){%>
        <a href= "<%= fileFuncPath %>" target="_blank"><%=functionName%></a>
      <%} else{%>
        <%=functionName%>
      <%}%>
    </td>
    <td rowspan="2" style="text-align: left"><% for( let i = 0; i < integrationFunctions.length; i++ ) { %><%=integrationFunctions[i].name%><br /><% } %></td>
    <% for( let i = 0; i < enabledITCoverageKind.length; i++ ) { %>
      <td><%= coverageInfoIT[i].coverage %></td>
    <% } %>
    <td rowspan="2"><%=resultKind%></td>
  </tr>
  <tr>
    <% for( let i = 0; i < enabledITCoverageKind.length; i++ ) { %>
      <td><%= coverageInfoIT[i].covered%>/<%=coverageInfoIT[i].total %></td>
    <% } %>
  </tr>
  <% } %>
</table>
<%if(jumpable){%>
  <div class="back-to-top">[ <a href="#top">返回开始</a> ｜ <a href="#integrateCoverage">返回本节</a> ]</div>
<%}%>
</body>
</html>
